"use strict";
cc._RF.push(module, 'dca3bvwZTZDu6NsE7YdwpM+', 'gameSetting');
// scripts/O1ModuleRes/control/gameSetting.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameEngine_1 = require("../../engines/gameEngine");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var gameSetting = /** @class */ (function (_super) {
    __extends(gameSetting, _super);
    function gameSetting() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        // LIFE-CYCLE CALLBACKS:
        _this.spfArySound = [];
        _this.spfAryVibrate = [];
        _this.spSound = null;
        _this.spVibrate = null;
        return _this;
    }
    gameSetting.prototype.onLoad = function () {
    };
    gameSetting.prototype.start = function () {
        gameEngine_1.modules().uiControlModule.showHideDialogAnimation(this.node.getChildByName('center'), true);
    };
    gameSetting.prototype.onBtnClose = function () {
        var _this = this;
        gameEngine_1.managers().soundMgr.playSound('mainSound/anNiu').then();
        gameEngine_1.managers().soundMgr.playVibrate();
        gameEngine_1.modules().uiControlModule.showHideDialogAnimation(this.node.getChildByName('center'), false, function () {
            _this.node.destroy();
        });
    };
    gameSetting.prototype.onBtnSwitchSet = function (event, custom) {
        switch (custom) {
            case 'sound': {
                gameEngine_1.managers().soundMgr.setSoundEnabled(!gameEngine_1.managers().soundMgr.isSoundEnabled());
                break;
            }
            case 'vibrate': {
                gameEngine_1.managers().soundMgr.setVibrateEnabled(!gameEngine_1.managers().soundMgr.isVibrateEnabled());
                break;
            }
        }
        gameEngine_1.managers().soundMgr.playSound('mainSound/anNiu').then();
        gameEngine_1.managers().soundMgr.playVibrate();
    };
    gameSetting.prototype.update = function (dt) {
        this.spSound.spriteFrame = this.spfArySound[Number(gameEngine_1.managers().soundMgr.isSoundEnabled())];
        this.spVibrate.spriteFrame = this.spfAryVibrate[Number(gameEngine_1.managers().soundMgr.isVibrateEnabled())];
    };
    __decorate([
        property({ type: [cc.SpriteFrame], displayName: '音效开关精灵帧' })
    ], gameSetting.prototype, "spfArySound", void 0);
    __decorate([
        property({ type: [cc.SpriteFrame], displayName: '振动开关精灵帧' })
    ], gameSetting.prototype, "spfAryVibrate", void 0);
    __decorate([
        property(cc.Sprite)
    ], gameSetting.prototype, "spSound", void 0);
    __decorate([
        property(cc.Sprite)
    ], gameSetting.prototype, "spVibrate", void 0);
    gameSetting = __decorate([
        ccclass
    ], gameSetting);
    return gameSetting;
}(cc.Component));
exports.default = gameSetting;

cc._RF.pop();